﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetDiskPRJ.DBUtility;
using System.Data;

namespace NetDiskPRJ.DAL
{
    public class SysParam
    {
        public SysParam()
        {

        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select FParamNo,FParamName,FValue,FNote ");
            strSql.Append(" FROM t_SysParam ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }
        /// <summary>
        /// 获得系统印花税相关数据列表
        /// <creator>wangl</creator>
        /// <date>2013-02-13</date>
        /// </summary>
        public DataSet GetStampTaxList()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT FParamNo,FParamName,FValue,FNote ");
            strSql.Append(" FROM t_SysParam ");
            strSql.Append(" WHERE  FParamNo='StampTaxCD' OR FParamNo='StampTaxRate'");
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NetDiskPRJ.Model.SysParam DataRowToModel(DataRow row)
        {
            NetDiskPRJ.Model.SysParam model = new NetDiskPRJ.Model.SysParam();
            if (row != null)
            {
                if (row["FParamNo"] != null)
                {
                    model.FParamNo = row["FParamNo"].ToString();
                }
                if (row["FParamName"] != null)
                {
                    model.FParamName = row["FParamName"].ToString();
                }
                if (row["FValue"] != null)
                {
                    model.FValue = row["FValue"].ToString();
                }
                if (row["FNote"] != null)
                {
                    model.FNote = row["FNote"].ToString();
                }
            }
            return model;
        }
    }
}